{% extends 'bootstrap/base.html' %}
{% import "bootstrap/utils.html" as util %}

{% block styles %}
  {{ super() }}
  <link rel="stylesheet" href="{{ url_for('static', filename='css/global.css') }}">
  <link rel="stylesheet" href="{{ url_for('static', filename='css/footer.css') }}">
{% endblock %}

{% block title %}
  {% if title %}{{ title }} &middot; AnnotateChange{% else %}Welcome to AnnotateChange{% endif %}
{% endblock %}

{% block navbar %}
  <nav class="navbar navbar-default">
    <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="{{ url_for('main.index') }}">AnnotateChange</a>
      </div>
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav">
          <li><a href="{{ url_for('main.index') }}">Home</a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
          {% if current_user.is_anonymous %}
            <li><a href="{{ url_for('auth.login') }}">Login</a></li>
            <li><a href="{{ url_for('auth.register') }}">Register</a></li>
          {% else %}
            {% if current_user.is_admin %}
              <li><a href="{{ url_for('admin.index') }}" style="color: red;">Admin Panel</a></li>
            {% endif %}
            <li><a href="{{ url_for('auth.logout') }}">Logout</a></li>
          {% endif %}
        </ul>
      </div>
    </div>
  </nav>
{% endblock %}

{% block content %}
  <main class="container">
  {{ util.flashed_messages(dismissible=True) }}
  {% block app_content %}
  {% endblock %}
  </main>
  {%- block footer %}
  <footer class="fixed-bottom">
    <div class="container">
      <span class="text-muted">This is AnnotateChange version {{ config.APP_VERSION }}. For questions or comments, please <a href="mailto:annotatechange@gmail.com">send us an email</a>.</span>
    </div>
  </footer>
  {%- endblock footer %}
{% endblock %}
